
package com.william.killian.trivia.model;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Root;

@Root (name = "Entry")
public class HighScoreEntry implements Comparable <HighScoreEntry>
{
    @Attribute (name = "name")
    private String name;

    @Attribute (name = "score")
    private Integer score;

    public HighScoreEntry () {

    }

    public HighScoreEntry (String name, Integer score) {
        this.name = name;
        this.score = score;
    }

    public String getName ()
    {
        return name;
    }

    public Integer getScore ()
    {
        return score;
    }
    
    public int compareTo (HighScoreEntry other)
    {
        return (other.score - this.score);
    }
    
    public String toString ()
    {
        return getScore () + "\t\t\t" + getName ();
    }
}
